var t = getApp();

Page({
    data: {
        selected: 5,
        tabArr: {
            curHdIndex: 0,
            curEdIndex: 0,
            curSdIndex: 0,
            curLdIndex: 0
        },
        test: "",
        scrollTop: {
            scroll_top: 0,
            goTop_show: !1
        },
        cur: "",
        showDialog: !1,
        loading: !1,
        pull: !0,
        scrolling: !1,
        windowHeight: 736,
        ordertype: 0,
        building: {},
        building_items: [],
        listorder: [],
        imgurls: [],
        cityOption: {},
        house_type: [],
        pages: 1,
        nohouse: !1,
        pointInfo: {},
        order: {},
        filter: {},
        filtercowork: "类型",
        filterPrice: "价格"
    },
    showFn: function() {
        var t = this;
        wx.makePhoneCall({
            phoneNumber: t.data.msg_template
        });
    },
    selectedFun: function(t) {
        var e = t.target.dataset.val;
        this.data.selected == e && (e = -1), this.setData({
            selected: e
        });
    },
    tabFun: function(t) {
        var e = Number(t.target.dataset.id), a = t.currentTarget.dataset.key, i = this.data.tabArr;
        i[a] = e, this.setData({
            tabArr: i
        });
    },
    goTopFun: function(t) {
        var e = this.data.scrollTop.scroll_top;
        e = 1 == e ? 0 : 1, this.setData({
            "scrollTop.scroll_top": e
        });
    },
    onLoad: function(e) {
        var a = this, i = t.getSecret();
        wx.request({
            url: t.globalData.haozuBase + "/api/miniapps/getqueryfilter/",
            data: {
                page_type: 2,
                building_id: e.building_id,
                house_type: 5,
                currtime: i.currtime,
                sign: i.sign
            },
            success: function(t) {
                var e = t.data;
                a.setData({
                    ul_areas: e.data.area
                }), a.setData({
                    price_cowork: e.data.price_cowork.price
                }), a.setData({
                    cowork_type: e.data.cowork_type
                }), a.setData({
                    listorder: e.data.listorder
                });
            }
        }), wx.request({
            url: t.globalData.haozuBase + "/api/miniapps/houselist/",
            data: {
                domain: t.globalData.domain,
                building_id: e.building_id,
                house_type: 5,
                currtime: i.currtime,
                sign: i.sign
            },
            success: function(t) {
                var e = t.data, i = e.data.house_list, s = e.data.building_info, o = [];
                for (var r in i) o.push(i[r]);
                a.setData({
                    building: s,
                    building_items: o
                }), wx.setNavigationBarTitle({
                    title: s.name + " | 共享办公出租",
                    success: function(t) {}
                });
            }
        }), wx.getSystemInfo({
            success: function(t) {
                a.setData({
                    windowHeight: t.windowHeight
                });
            }
        });
    },
    goTap: function(e) {
        var a = this, i = e.currentTarget.dataset;
        void 0 === i.listorder ? (a.setData({
            filter: i,
            filterPrice: i.totleprice,
            filtercowork: i.coworktype
        }), i = t.extend(i)) : (a.setData({
            order: i,
            ordertype: i.listorder
        }), i = t.extend(i));
        var s = t.getSecret(), o = t.extend({
            domain: t.globalData.domain,
            house_type: 5,
            building_id: a.data.building.id,
            currtime: s.currtime,
            sign: s.sign
        }, i);
        wx.request({
            url: t.globalData.haozuBase + "/api/miniapps/houselist/",
            data: o,
            success: function(t) {
                var e = t.data;
                if (200 === t.data.code) {
                    var i = e.data.house_list;
                    a.setData({
                        building_items: i,
                        selected: 5,
                        nohouse: !1,
                        house_show: !0,
                        showDialog: !1,
                        scrollTop: 0
                    });
                } else a.setData({
                    building_items: [],
                    nohouse: !0,
                    house_show: !1,
                    selected: 5,
                    showDialog: !1
                });
            }
        });
    },
    onClickButton: function(t) {
        var e = this;
        switch (t.currentTarget.dataset.index) {
          case "0":
            e.setData({
                showDialog: !this.data.showDialog
            });
        }
    },
    onClickdiaView: function() {
        this.setData({
            showDialog: !this.data.showDialog
        });
    },
    closeFun: function() {
        this.setData({
            selected: 5,
            showDialog: 0
        });
    },
    emptyFun: function() {}
});